package com.test.sort;

public class EasyChooseSort {
	public static void main(String[] args) {
		int arrLen = (int) Math.round(Math.random() * 10);
		int[] arr = new int[arrLen];
		for (int i = 0; i < arrLen; i++) {
			arr[i] = (int) Math.round(Math.random() * 10);
		}
		for (int i = 0; i < arrLen; i++) {
			System.out.print(arr[i] + ",");
		}

		System.out.println();

		for (int i = 0; i < arrLen; i++) {
			int min = arr[i], minIndex = i;
			for (int j = i; j < arrLen; j++) {
				if (arr[j] < min) {
					min = arr[j];
					minIndex = j;
				}
			}
			if (minIndex != i) {
				for (int j = minIndex; j > i; j--) {
					int temp = arr[j];
					arr[j] = arr[j - 1];
					arr[j - 1] = temp;
				}
			}
		}
		

		for (int i = 0; i < arrLen; i++) {
			System.out.print(arr[i] + ",");
		}

	}
}
